<template>
  <div class="header" v-if="seller.supports" @click="showDetail">
    <div class="content-wrapper">
      <div class="avatar">
        <img :src="seller.avatar" alt="" width="64" height="64" />
      </div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{ seller.name }}</span>
        </div>
        <div class="description">
          {{ seller.description }}/{{ seller.deliveryTime }}分钟送达
        </div>
        <div class="supports">
          <!-- 活动 -->
          <Support-ico :type="seller.supports[0].type" :size="1"></Support-ico>
          <span class="text">{{ seller.supports[0].description }}</span>
        </div>
      </div>
      <div class="support-count">
        <span class="count">{{ seller.supports.length }}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>

    <!-- 公告 -->
    <div class="bulletin-wrapper">
      <span class="bulletin-title"></span>
      <span class="bulletin-text">{{ seller.bulletin }}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <!-- 背景 -->
    <div class="backgroud">
      <img :src="seller.avatar" width="100%" height="100%" alt="" />
    </div>
    <header-detail
      :supports="seller.supports"
      :bulletin="seller.bulletin"
      :name="seller.name"
      v-show="detailVisible"
      @hide="hideDetail"
    ></header-detail>
  </div>
</template>

<script>
import Support from "@/components/support-ico/support-ico";
import headerDetailVue from "@/components/header-detail/header-detail";
export default {
  props: {
    seller: {
      type: Object,
      default() {
        // 默认值
        return {};
      },
    },
  },
  data() {
    return {
      detailVisible: false,
    };
  },
  components: {
    "Support-ico": Support,
    "header-detail": headerDetailVue,
  },
  methods: {
    showDetail() {
      this.detailVisible = true;
    },
    hideDetail(e){
      
      this.detailVisible = e
    }
  },
};
</script>

<style lang="less">
.header {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: rgba(0, 17, 27, 0.5);
}
.content-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  padding: 24px 12px 18px 24px;
  .avatar {
    flex: 0 0 64px;
    width: 64px;
    margin-right: 16px;
    img {
      border-radius: 2px;
    }
  }
  .content {
    flex: 1;
    .title {
      display: flex;
      align-items: center;
      margin-bottom: 8px;
      .brand {
        width: 30px;
        height: 18px;
        background-image: url("brand@2x.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;
      }
      .name {
        margin-left: 6px;
        font-size: 16px;
        font-weight: bold;
      }
    }
    .description {
      margin-bottom: 8px;
      line-height: 12px;
      font-size: 12px;
    }
    .supports {
      display: flex;
      align-items: center;
      .support-ico {
        margin-right: 4px;
      }
      .text {
        line-height: 12px;
        font-size: 10px;
      }
    }
  }
  .support-count {
    position: absolute;
    right: 12px;
    bottom: 14px;
    display: flex;
    align-items: center;
    text-align: center;
    line-height: 24px;
    padding: 0 8px;
    height: 24px;
    border-radius: 14px;
    background: rgba(7, 17, 27, 0.2);
    font-size: 10px;
  }
}
.backgroud {
  position: absolute;
  overflow: hidden;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
  filter: blur(10px);
}
.bulletin-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  height: 28px;
  line-height: 28px;
  padding: 0 8px;
  background: rgba(7, 17, 27, 0.2);
  .bulletin-title {
    flex: 0 0 22px;
    width: 22px;
    height: 12px;
    margin-right: 4px;
    background-image: url("bulletin@2x.png");
    background-repeat: no-repeat;
    background-size: contain;
  }
  .bulletin-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 10px;
  }
  i {
    flex: 0 0 10px;
    width: 10px;
    font-size: 10px;
  }
}
</style>